package com.sokal.easycare.modules.buyercart.entity;

import java.util.Date;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sokal.easycare.common.persistence.DataEntity;
import com.sokal.easycare.modules.product.entity.product.ProProduct;
import com.sokal.easycare.modules.service.entity.SerService;

/**
 * 购物车Entity
 * 
 * @author nibo
 * @version 2017-03-27
 */
public class BuyerCart extends DataEntity<BuyerCart> {

	private static final long serialVersionUID = 1L;
	private String userId; // user_id
	private String offerPackId; // 商品id
	private String serviceId; // 服务id
	private Date stateDate; // 状态时间，最后添加到购物车的时间。
	private String type; // type商品类别 1:实物,2:服务
	private Integer num; // 数量
	private SerService serviceData;// 商品
	private ProProduct offerPackData;// 商品

	public SerService getServiceData() {
		return serviceData;
	}

	public void setServiceData(SerService serviceData) {
		this.serviceData = serviceData;
	}

	public ProProduct getOfferPackData() {
		return offerPackData;
	}

	public void setOfferPackData(ProProduct offerPackData) {
		this.offerPackData = offerPackData;
	}

	public BuyerCart() {
		super();
	}

	public BuyerCart(String id) {
		super(id);
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@Length(min = 1, max = 30, message = "序列号长度必须介于 1 和 30 之间")
	public String getOfferPackId() {
		return offerPackId;
	}

	public void setOfferPackId(String offerPackId) {
		this.offerPackId = offerPackId;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@NotNull(message = "状态时间，最后添加到购物车的时间。不能为空")
	public Date getStateDate() {
		return stateDate;
	}

	public void setStateDate(Date stateDate) {
		this.stateDate = stateDate;
	}

	@Length(min = 1, max = 11, message = "type长度必须介于 1 和 11 之间")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	public String getServiceId() {
		return serviceId;
	}

	public void setServiceId(String serviceId) {
		this.serviceId = serviceId;
	}

}